package com.mulanweb.api.module.controller.admin;

import com.jfinal.plugin.activerecord.Page;
import com.mulanweb.api.module.controller.BaseController;
import com.mulanweb.api.module.model.*;
import com.mulanweb.db.common.SQLGenerateHelper;
import com.mulanweb.validator.annotation.ValidateForm;

/**
 * Created by Administrator on 2016/11/8 0008.
 */
public class ChatHistoryController extends BaseController {
    public void searchUser() {
        User user = User.dao.findById(getParaToLong("userId"));
        SQLGenerateHelper helper = new SQLGenerateHelper("chat_history", "sent_time desc");
        helper.addEqualsCondition("to_user_openid",user.getOpenId());
        helper.addEqualsCondition("from_user_openid",user.getOpenId());
        Page<ChatHistory> page = ChatHistory.dao.paginate(1, 500, helper.getSqlSelect(), helper.getSqlExceptSelect().replace("AND","OR"), helper.getQueryParas());
        returnPageModelJson(page);
    }
}


